
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
>

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-sref="main"><i class="glyphicon glyphicon-modal-window"></i> 设备管理</a></li>
        <li><a ui-sref="main.dm.dmManager.list" class="active" ng-bind="title"></a></li>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg dataWarn"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-heading clearfix">
                <div class="w-auto">
                    <form ng-submit="search()" class="form-inline">
                        <div class="form-group">
                            <label for="deviceCode">设备编码：</label>
                            <input type="text"
                                   class="form-control" style="width: 140px"
                                   id="deviceCode"
                                   placeholder="" ng-model="param.deviceCode">
                        </div>
                        <div class="form-group">
                            <label for="categoryName">设备类型：</label>
                            <input type="text"
                                   class="form-control" style="width: 140px"
                                   id="categoryName"
                                   placeholder="" ng-model="param.categoryName">
                        </div>
                        <div class="form-group">
                            <label for="status">设备状态：</label>
                            <select class="form-control" style="width: 140px" ng-model="param.status" name="status"
                                    id="status">
                                <option value="" ng-selected="1">全部</option>
                                <option value="1">启用</option>
                                <option value="0">停用</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="onlineStatus">在线状态：</label>
                            <select class="form-control" style="width: 140px" ng-model="param.onlineStatus"
                                    name="onlineStatus" id="onlineStatus">
                                <option value="" ng-selected="1">全部</option>
                                <option value="1">在线</option>
                                <option value="0">离线</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="address">楼栋地址：</label>
                            <input type="text"
                                   class="form-control" style="width: 140px"
                                   id="address"
                                   placeholder="" ng-model="param.address">
                        </div>

                        <div class="form-group">
                            <button type="submit" class="btn btn-primary new-primary"
                                    style="margin-left: 10px" ng-show="read">查询
                            </button>
                        </div>

                        <div class="form-group">
                            <a ui-sref="main.dm.dmManager.create" class="btn btn-primary addNew" ng-show="add"><i
                                    class="glyphicon glyphicon-plus"></i>新增</a>
                        </div>
                    </form>
                </div>
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center">
                    <thead>
                    <tr>
                        <th>设备编码</th>
                        <th>设备名称</th>
                        <th>楼栋地址</th>
                        <th>状态</th>
                        <th>在线状态</th>
                        <!--<th>设备能力</th> -->
                        <th>设备类型</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageInfo.data">
                        <td class="v-middle">{{item.deviceCode}}</td>
                        <td class="v-middle">{{item.deviceName}}</td>
                        <td class="v-middle">{{item.address}}</td>
                        <td class="v-middle">
                            <span ng-if="item.status==1" class="text-success">启用</span>
                            <span ng-if="item.status==0" class="text-danger">停用</span>
                        </td>
                        <td class="v-middle">
                            <span ng-if="item.deviceStatus==1" class="text-success">在线</span>
                            <span ng-if="item.deviceStatus==0" class="text-danger">离线</span>
                            <span ng-if="item.deviceStatus==2" class="text-danger">异常</span>
                        </td>
                        <!--<td class="v-middle">{{item.abilityName}}</td>-->
                        <td class="v-middle">{{item.categoryName}}</td>
                        <td class="v-middle">
                            <p class="handle-p">
                                <a href="#"
                                   ui-sref="main.dm.dmManager.details({'id':item.deviceId})"
                                   ng-show="read">详情</a>
                                <a href="#" ui-sref="main.dm.dmManager.update({'id':item.deviceId})"
                                   ng-show="update">编辑</a>
                                <a ng-click="delDevice(item.deviceId,item.deviceCode)" ng-show="dele">删除</a>
                                <a ng-click="deviceOpen(item)"style="border:solid 1px;color:#fb7009;border-radius:4px;"ng-show="item.status==1">开门</a>
                                <a ng-click="changeDevice(item.deviceId)" style="border:solid 1px;color:#fb7009;border-radius:4px;">设备替换</a>
                            </p>

                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
          
            <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
        </div>
       
    </div>
   

</div>
</div>

<script type="text/ng-template" id="changeDevice.html">
<!-- 导航条 -->
<div class="bg-white">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><i class="glyphicon glyphicon-modal-window"></i> 设备管理</li>
        <li><span class="active" ng-bind="title"></span></li>
    </ul>
</div>
<div class="wrapper-md content">
    <div class="panel panel-default">
        <!-- 头部 -->
        <div class="panel-heading font-bold"></div>
        <!--表单-->
        <div class="panel-body" >
            <form class="form-horizontal" id="changeDevice"  autocomplete="off">
                <div class="form-group clearfix">
                    <label for="deviceCode" class="col-lg-2 control-label text-right"><span class="text-danger wrapper-sm">*</span>设备编号：</label>
                    <div class="col-lg-6">
                        <input type="text" class="form-control" ng-model="record.deviceCode" maxlength="25" name="deviceCode" id="deviceCode" ng-focus="hiden()">
                        <span style="color: red;" ng-show="deviceCodeNULL">请您填写设备编码！</span>
                    </div>
                </div>
 				<div class="line line-dashed b-b line-lg pull-in"></div>
                <div class="form-group clearfix">
                    <label for="productId" class="col-lg-2 control-label text-right"><span class="text-danger wrapper-sm">*</span>产品名称：</label>
                    <div class="col-lg-6">
                        <select class="form-control" name="productId" id="productId" ng-model="record.productId" ng-focus="hiden()">
                        	<option ng-repeat="item in pageInfo"  value="{{item.productId}}" data-code="{{item.masterApikey}}">{{item.productName}}</option>
                        </select>
                        <span style="color: red;" ng-show="productIdNULL">请选择产品类型</span>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                
                <div class="form-group" style="width: 100%">
                    <div class="col-sm-6 col-sm-offset-2 text-center"
                         style="width: 100%;margin: 0;padding: 0;text-align: center">
                        <button type="button" class="btn w-xs addNew" ng-click="resetFrom()">重置</button>
                        <button class="btn btn-info w-xs m-l-xl addNew"
                                ng-disabled="isDisabled" ng-click="saveDevice()">保存
                        </button>
                        <button type="button" class="btn btn-info w-xs m-l-xl addNew" ng-click="cancel()">取消</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</script>
<!-- /.wrapper-md -->
<style type="text/css" scoped>
    .table-responsive table tbody tr td {
        margin: 0;
        padding: 9px 0;
        width: auto;
    }

    .handle-p {
        margin: 0;
        padding: 0;
        font-size: 16px;
    }

    .handle-p a {
        padding: 2px 5px;
    }
    
</style>